package sample;

import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleFloatProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

import java.math.BigDecimal;

/**
 * Created by ezinzng on 11/7/2016.
 */
public class CoalStatistic {

    private SimpleStringProperty type, seqNum, trainNum, date, time;
    private SimpleIntegerProperty firstTrain, lastTrain;

    private SimpleDoubleProperty mineMt, portMt, minusMt, mineMad, portMad, minusMad, mineAd, portAd, minusAd, mineVd, portVd, minusVd, mineStd, portStd, minusStd, mineQnetar, portQnetar, minusQnetar;

    private SimpleStringProperty mineSamplingType, portSamplingType, port, testOrg, deliveryType;

    public CoalStatistic(String type, String seqNum, String trainNum, String date, String time, int firstTrain, int lastTrain, double mineMt, double portMt, double mineMad, double portMad, double mineAd, double portAd, double mineVd, double portVd, double mineStd, double portStd, double mineQnetar, double portQnetar, String mineSamplingType, String portSamplingType, String port, String testOrg, String deliveryType) {
        this.type = new SimpleStringProperty(type);
        this.seqNum = new SimpleStringProperty(seqNum);
        this.trainNum = new SimpleStringProperty(trainNum);
        this.date = new SimpleStringProperty(date);
        this.time = new SimpleStringProperty(time);
        this.firstTrain = new SimpleIntegerProperty(firstTrain);
        this.lastTrain = new SimpleIntegerProperty(lastTrain);
        this.mineMt = new SimpleDoubleProperty(mineMt);
        this.portMt = new SimpleDoubleProperty(portMt);
        this.minusMt = new SimpleDoubleProperty(minus(mineMt, portMt));
        this.mineMad = new SimpleDoubleProperty(mineMad);
        this.portMad = new SimpleDoubleProperty(portMad);
        this.minusMad = new SimpleDoubleProperty(minus(mineMad, portMad));
        this.mineAd = new SimpleDoubleProperty(mineAd);
        this.portAd = new SimpleDoubleProperty(portAd);
        this.minusAd = new SimpleDoubleProperty(minus(mineAd, portAd));
        this.mineVd = new SimpleDoubleProperty(mineVd);
        this.portVd = new SimpleDoubleProperty(portVd);
        this.minusVd = new SimpleDoubleProperty(minus(mineVd, portVd));
        this.mineStd = new SimpleDoubleProperty(mineStd);
        this.portStd = new SimpleDoubleProperty(portStd);
        this.minusStd = new SimpleDoubleProperty(minus(mineStd, portStd));
        this.mineQnetar = new SimpleDoubleProperty(mineQnetar);
        this.portQnetar = new SimpleDoubleProperty(portQnetar);
        this.minusQnetar = new SimpleDoubleProperty(minus(mineQnetar, portQnetar));
        this.mineSamplingType = new SimpleStringProperty(mineSamplingType);
        this.portSamplingType = new SimpleStringProperty(portSamplingType);
        this.port = new SimpleStringProperty(port);
        this.testOrg = new SimpleStringProperty(testOrg);
        this.deliveryType = new SimpleStringProperty(deliveryType);
    }

    public String getType() {
        return type.get();
    }

    public void setType(String type) {
        this.type.set(type);
    }

    public String getSeqNum() {
        return seqNum.get();
    }

    public void setSeqNum(String seqNum) {
        this.seqNum.set(seqNum);
    }

    public String getTrainNum() {
        return trainNum.get();
    }

    public void setTrainNum(String trainNum) {
        this.trainNum.set(trainNum);
    }

    public String getDate() {
        return date.get();
    }

    public void setDate(String date) {
        this.date.set(date);
    }

    public String getTime() {
        return time.get();
    }

    public void setTime(String time) {
        this.time.set(time);
    }

    public int getFirstTrain() {
        return firstTrain.get();
    }

    public void setFirstTrain(int firstTrain) {
        this.firstTrain.set(firstTrain);
    }

    public int getLastTrain() {
        return lastTrain.get();
    }

    public void setLastTrain(int lastTrain) {
        this.lastTrain.set(lastTrain);
    }

    public double getMineMt() {
        return mineMt.get();
    }

    public void setMineMt(double mineMt) {
        this.mineMt.set(mineMt);
    }

    public double getPortMt() {
        return portMt.get();
    }

    public void setPortMt(double portMt) {
        this.portMt.set(portMt);
    }

    public double getMinusMt() {
        return minusMt.get();
    }

    public void setMinusMt(double minusMt) {
        this.minusMt.set(minusMt);
    }

    public double getMineMad() {
        return mineMad.get();
    }

    public void setMineMad(double mineMad) {
        this.mineMad.set(mineMad);
    }

    public double getPortMad() {
        return portMad.get();
    }

    public void setPortMad(double portMad) {
        this.portMad.set(portMad);
    }

    public double getMinusMad() {
        return minusMad.get();
    }

    public void setMinusMad(double minusMad) {
        this.minusMad.set(minusMad);
    }

    public double getMineAd() {
        return mineAd.get();
    }

    public void setMineAd(double mineAd) {
        this.mineAd.set(mineAd);
    }

    public double getPortAd() {
        return portAd.get();
    }

    public void setPortAd(double portAd) {
        this.portAd.set(portAd);
    }

    public double getMinusAd() {
        return minusAd.get();
    }

    public void setMinusAd(double minusAd) {
        this.minusAd.set(minusAd);
    }

    public double getMineVd() {
        return mineVd.get();
    }

    public void setMineVd(double mineVd) {
        this.mineVd.set(mineVd);
    }

    public double getPortVd() {
        return portVd.get();
    }

    public void setPortVd(double portVd) {
        this.portVd.set(portVd);
    }

    public double getMinusVd() {
        return minusVd.get();
    }

    public void setMinusVd(double minusVd) {
        this.minusVd.set(minusVd);
    }

    public double getMineStd() {
        return mineStd.get();
    }

    public void setMineStd(double mineStd) {
        this.mineStd.set(mineStd);
    }

    public double getPortStd() {
        return portStd.get();
    }

    public void setPortStd(double portStd) {
        this.portStd.set(portStd);
    }

    public double getMinusStd() {
        return minusStd.get();
    }

    public void setMinusStd(double minusStd) {
        this.minusStd.set(minusStd);
    }

    public double getMineQnetar() {
        return mineQnetar.get();
    }

    public void setMineQnetar(double mineQnetar) {
        this.mineQnetar.set(mineQnetar);
    }

    public double getPortQnetar() {
        return portQnetar.get();
    }

    public void setPortQnetar(double portQnetar) {
        this.portQnetar.set(portQnetar);
    }

    public double getMinusQnetar() {
        return minusQnetar.get();
    }

    public void setMinusQnetar(double minusQnetar) {
        this.minusQnetar.set(minusQnetar);
    }

    public String getMineSamplingType() {
        return mineSamplingType.get();
    }

    public void setMineSamplingType(String mineSamplingType) {
        this.mineSamplingType.set(mineSamplingType);
    }

    public String getPortSamplingType() {
        return portSamplingType.get();
    }

    public void setPortSamplingType(String portSamplingType) {
        this.portSamplingType.set(portSamplingType);
    }

    public String getPort() {
        return port.get();
    }

    public void setPort(String port) {
        this.port.set(port);
    }

    public String getTestOrg() {
        return testOrg.get();
    }

    public void setTestOrg(String testOrg) {
        this.testOrg.set(testOrg);
    }

    public String getDeliveryType() {
        return deliveryType.get();
    }

    public void setDeliveryType(String deliveryType) {
        this.deliveryType.set(deliveryType);
    }

    private double minus(double a, double b)  {
        double ret = a - b;
        BigDecimal bd = new BigDecimal(ret);
        return bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
}
